package com.zzgele.qmzb.api.dao;

import com.zzgele.qmzb.api.core.Mapper;
import com.zzgele.qmzb.api.model.WithdrawalsLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

@Repository
public interface WithdrawalsLogMapper extends Mapper<WithdrawalsLog> {

    @Select("select sum(surplus) from withdrawals_log where  uid=#{uid} " +
            "and create_time>=#{startTime} and create_time<#{endTime} and status in(0,1)")
    BigDecimal getTotalMoneyOneMonth(@Param("uid") Long uid, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime);

    @Select("select name,status,create_time,surplus*0.1 as money from withdrawals_log where uid=#{uid}  ")
    List<HashMap> list(@Param("uid") Long uid);
}